package com.xma.springcloud.alibaba.controller;

import com.xma.springcloud.alibaba.entity.TStorage;
import com.xma.springcloud.alibaba.service.TStorageService;
import com.xma.springcloud.common.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (TStorage)表控制层
 *
 * @author makejava
 * @since 2020-07-07 17:50:45
 */
@RestController
@Slf4j
public class TStorageController {
    /**
     * 服务对象
     */
    @Resource
    private TStorageService tStorageService;

    @PostMapping(value = "/storage/decrease")
    public ResponseResult decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count){
        log.info("--------订单微服务开始调用库存，做扣减");
        ResponseResult update = tStorageService.update(productId, count);
        log.info("--------订单微服务开始调用库存，做扣减end");
        return update;
    }
}